home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / Vk / VkInterruptDialog.z / VkInterruptDialog
Encoding:
Text File  |  2002-10-03  |  9.5 KB  |  265 lines

  1.  
  2.  
  3.  
  4. VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                    VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      VkInterruptDialog - A dialog manager that support interrupts
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      VkBusyDialog : VkDialogManager : VkComponent : VkCallbackObject
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <Vk/VkInterruptDialog.h>
  16.  
  17. PPPPUUUUBBBBLLLLIIIICCCC PPPPRRRROOOOTTTTOOOOCCCCOOOOLLLL SSSSUUUUMMMMMMMMAAAARRRRYYYY
  18.    CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrr////DDDDeeeessssttttrrrruuuuccccttttoooorrrr
  19.            VkInterruptDialog(const char* name);
  20.            virtual void ~VkInterruptDialog(void);
  21.  
  22.  
  23.    CCCChhhheeeecccckkkkiiiinnnngggg ffffoooorrrr IIIInnnntttteeeerrrrrrrruuuuppppttttssss
  24.            Boolean wasInterupted(void);
  25.  
  26.  
  27. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.           This class supports applications that need to perform a lengthy task
  29.           and allow the task to be interrupted. To use the dialog,
  30.           applications must use the _V_k_A_p_p::_s_e_t_B_u_s_y_D_i_a_l_o_g() method to install
  31.           an instance of VkInterruptDialog as the application's current busy
  32.           dialog, and then call _V_k_A_p_p::_b_u_s_y() Applications must periodically
  33.           check to see if the application has been interrupted. The period of
  34.           time between checks is up to the application, which must weigh
  35.           responsiveness against time spent checking.
  36.  
  37.           Note that checking for interrupts involves entering a secondary
  38.           event loop for a short time, so the application must beware of re-
  39.           entrancy problems in any callbacks that could be invoked.
  40.  
  41.  
  42.  
  43. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  44.    VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg(((())))
  45.            VkInterruptDialog(const char* name);
  46.  
  47.  
  48.           Initialize a VkInterruptDialog object. Normally, applications can
  49.           use the globally instantiated _t_h_e_I_n_t_e_r_r_u_p_t_D_i_a_l_o_g.
  50.  
  51.    ~~~~VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg(((())))
  52.            virtual void ~VkInterruptDialog(void);
  53.  
  54.  
  55.           Free the memory associated with a VkInterruptDialog object.
  56.  
  57.    wwwwaaaassssIIIInnnntttteeeerrrruuuupppptttteeeedddd(((())))
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                    VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  71.  
  72.  
  73.  
  74.            Boolean wasInterupted(void);
  75.  
  76.  
  77.           Check to see if the user has pushed the dialog's "cancel" button
  78.           since the last time this function was called.
  79.  
  80. DDDDAAAATTTTAAAA MMMMEEEEMMMMBBBBEEEERRRR DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  81.    ccccoooonnnnsssstttt cccchhhhaaaarrrr**** ccccoooonnnnsssstttt iiiinnnntttteeeerrrrrrrruuuupppptttteeeeddddCCCCaaaallllllllbbbbaaaacccckkkk;;;;
  82.            static const char *const interruptedCallback;
  83.  
  84.  
  85.           This callback list allows objects to register a member function to
  86.           be called when the user selects the "Cancel" button of a
  87.           VkInterruptDialog dialog. This callback can only be called if the
  88.           application calls _w_a_s_I_n_t_e_r_r_u_p_t_e_d(). Normally, the application will
  89.           test the return value of this function, but the callback may be
  90.           useful in other situations.
  91.  
  92. EEEEXXXXAAAAMMMMPPPPLLLLEEEE
  93.           The following code segment installs the interrupt dialog, and
  94.           performs a simulated lengthy task, checking for interrupts
  95.           periodically.
  96.  
  97.  
  98.            int i, j, k = 0;
  99.  
  100.             // Install the interruptible dialog as the
  101.             // dialog to post when busy
  102.  
  103.             theApplication->setBusyDialog(theInterruptDialog);
  104.  
  105.             // Start being "busy"
  106.  
  107.             theApplication->busy("Very Busy",
  108.                                  (BusyWindow *) clientData);
  109.  
  110.             k = 0;
  111.  
  112.             for(i=0; i<10000; i++)
  113.             {
  114.                  // Every so often, see if the task
  115.                  // was interrupted
  116.  
  117.                   if(theInterruptDialog->wasInterupted())
  118.                   {
  119.                       break;  // kick out of current
  120.                               // task if user interrupts
  121.                   }
  122.  
  123.                   sleep(1);
  124.               }
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                    VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  137.  
  138.  
  139.  
  140.               // Task done, so we're not busy anymore
  141.  
  142.               theApplication->notBusy();
  143.  
  144.               // Restore the application's busy dialog
  145.               // as the default
  146.  
  147.               theApplication->setBusyDialog(NULL);
  148.  
  149.  
  150.  
  151. IIIINNNNHHHHEEEERRRRIIIITTTTEEEEDDDD MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  152.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkDDDDiiiiaaaallllooooggggMMMMaaaannnnaaaaggggeeeerrrr
  153.           show(), hide(), className(), clearCache(), prepost(), ok(),
  154.           cancel(), apply(), setTitle(), setButtonLabels(), unpost(),
  155.           unpostAll(), centerOnScreen(), lastPosted(), post(), postModal(),
  156.           postBlocked(), postAndWait(), post(), _action, _showOK, _showCancel,
  157.           _showApply, _allowMultipleDialogs, _minimizeMultipleDialogs,
  158.           prepostCallback
  159.  
  160.  
  161.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkCCCCoooommmmppppoooonnnneeeennnntttt
  162.           installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(),
  163.           setDefaultResources(), getResources(), manage(), unmanage(),
  164.           baseWidget(), okToQuit(), _name, _baseWidget, _w, deleteCallback
  165.  
  166.  
  167.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm VVVVkkkkCCCCaaaallllllllbbbbaaaacccckkkkOOOObbbbjjjjeeeecccctttt
  168.           callCallbacks(), addCallback(), removeCallback(),
  169.           removeAllCallbacks()
  170.  
  171.  
  172. VVVVIIIIEEEEWWWWKKKKIIIITTTT 2222....1111 CCCCHHHHAAAANNNNGGGGEEEESSSS
  173.      In multi-screen enabled applications or components, references to
  174.      _t_h_e_I_n_t_e_r_r_u_p_t_D_i_a_l_o_g will only be valid for the _d_e_f_a_u_l_t screen in the
  175.      application.  The following new function API will return the
  176.      VkInterruptDialog associated with the appropriate screen and should be
  177.      used instead of _t_h_e_I_n_t_e_r_r_u_p_t_D_i_a_l_o_g;
  178.  
  179.  
  180.            VkInterruptDialog *getAppInterruptDialog(VkComponent *comp);
  181.  
  182.  
  183. CCCCLLLLAAAASSSSSSSSEEEESSSS UUUUSSSSEEEEDDDD BBBBYYYY TTTTHHHHIIIISSSS CCCCLLLLAAAASSSSSSSS
  184.      VkApp
  185.  
  186. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  187.      VkBusyDialog, VkDialogManager, VkComponent, VkApp
  188.      _V_i_e_w_K_i_t _P_r_o_g_r_a_m_m_e_r'_s _G_u_i_d_e
  189.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m, DEC Press, Bob Sheifler and Jim Gettys
  190.      _T_h_e _X _W_i_n_d_o_w _S_y_s_t_e_m _T_o_o_l_k_i_t, DEC Press, Paul Asente and Ralph Swick
  191.      _T_h_e _O_S_F/_M_o_t_i_f _P_r_o_g_r_a_m_m_e_r_s _R_e_f_e_r_e_n_c_e, Prentice Hall, OSF
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))                                    VVVVkkkkIIIInnnntttteeeerrrrrrrruuuuppppttttDDDDiiiiaaaalllloooogggg((((3333xxxx))))
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.                                                                         PPPPaaaaggggeeee 4444
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.